package org.nod.atgm.gameobjects;

import com.threed.jpct.Object3D;
import com.threed.jpct.SimpleVector;

public abstract class AbstractGameObject implements IGameObject {
	
	protected Object3D gameObject;
	
	public AbstractGameObject() {
		gameObject = createObject();
	}
	
	protected abstract Object3D createObject();

	@Override
	public Object3D getObject() {
		return gameObject;
	}

	@Override
	public void translate(float x, float y, float z) {
		gameObject.translate(x,y,z);
	}
	
	public void translate(SimpleVector position) {
		gameObject.translate(position);
	}
	
	public void setOrientation(SimpleVector dir, SimpleVector up) {
		gameObject.setOrientation(dir,up);
	}

	@Override
	public void rotateX(float x) {
		gameObject.rotateX(x);
	}

	@Override
	public void rotateY(float y) {
		gameObject.rotateY(y);
	}

	@Override
	public void rotateZ(float z) {
		gameObject.rotateZ(z);
	}
	
	@Override
	public String getName() {
		if (gameObject == null)
			return null;
		return gameObject.getName();
	}
	
	@Override
	public void setName(String name) {
		if (gameObject != null)
			gameObject.setName(name);
	}

}
